package com.awenhui.demo.study;

import com.sun.nio.sctp.IllegalReceiveException;

/**
 * @author yuxf
 * @version 1.0
 * @date 2020/9/21 15:00
 */
public interface IResultCode {

    int getCode();
    String getMessage();

    //登录错误，最好单独写在一个文件中
    enum LoginResult implements IResultCode {
        SERVER_ERROR(501, "服务器错误"),   PASSWORD_ERROR(502, "密码错误");

        LoginResult(int code, String message) {
            this.code = code;
            this.message = message;
        }
        private int code;
        private String message;

        @Override
        public int getCode() {
            return 0;
        }

        @Override
        public String getMessage() {
            return null;
        }
    };
    //注册错误，最好单独写在一个文件中
    enum RegResult implements IResultCode{
        //...
        ;

        @Override
        public int getCode() {
            return 0;
        }

        @Override
        public String getMessage() {
            return null;
        }
    }

}
